


<form action="" method="get" name="frmList" >
    <div class="searchcontent">
        <div style="" id="UsernameSearchParamsDiv" class="usersearchrow">
            <div class="usersearchcol1">
                <p>Search for a Username:</p>
                <input name ="UsernameSearchTextBox" type="text" maxlength="16" name="">
                <input name="searchmethod" id="searchmethod" type="hidden" value="">
            </div>
            <script>
                function onclicksubmenuitem() {
                    // alert('House No. not empty');
                    //var some_js_var = '';
                    // $('#mysearch').html(some_js_var);
                    //cai nay la exact fai ko uh
                    $('#searchmethod').val('0');

                }

                function onclicksubmenuitem1() {
                    //alert('House No. not empty');
                    //  var some_js_var = '<input name ="UsernameSearchTextBox1" type="text" maxlength="16" name="">';
                    //   $('#mysearch').html(some_js_var);
                    $('#searchmethod').val('1');
                }
            </script>
            <div class="usersearchcol2">
                <div class="">
                    <div class="listpagelinksarea">
                        <div id ="mysearch">
                            <div class="listpagelinksarea3 listpagelinksarea3off">
                                <p>
                                    <a id="UsernameSearchExactMatchLink" href="javascript:void(0);" onclick ="onclicksubmenuitem();">Similar</a></p>
                            </div>
                            <div class="listpagelinksarea1 listpagelinksarea1on">
                                <p>
                                    <a id="UsernameSearchExactMatchLink" href="javascript:void(0);" onclick ="onclicksubmenuitem1();">Exact</a></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div style="display: none;" class="usersearchcol3">
                <div class="searchcol2top">
                    <input type="radio" id="UsernameGenderFemale" checked="" value="2" name="sexusername">
                    <p>
                        <label for="UsernameGenderFemale">
                            Women</label></p>
                </div>
                <div class="searchcol2bottom">
                    <input type="radio" id="UsernameGenderMale" value="1" name="sexusername">
                    <p>
                        <label for="UsernameGenderMale">
                            Men</label></p>
                </div>
            </div>
            <div class="usersearchcol4">
                <p>
                    <input type="submit" value="Search" style="padding:2px; background-color: #FA8100 !important; border-radius: 3px;color: #FFFFFF;text-shadow: 1px 1px 1px #333333;font-size: 18px;font-weight: bold;padding: 5px 10px;margin-top: -8px;">
                    <!--<a id="UsernameSearchButton" type ="submit" name="submit" title="Search" class="button_style" href="javascript:;">Search</a>-->
                </p>
            </div>
        </div>
    </div>
</form>

<?php
if (!empty($models)) {
    ?>
    <div style="" id="SearchResultsContainer">              
        <script>
            PeopleMedia.Search.SetDefaultUserNameSearched('aaa');
        </script>
        <script>
            PeopleMedia.Search.SetCurrentPage(1);
            PeopleMedia.Search.SetViewGallery(false);
        </script>
        <div class="searchresults" style="border-top: medium none;">
            <div class="yescontenttoprow">
                <p class="results"><?php echo $i; ?>
                    results</p>
                <!--<div class="color-main" id="paginationalone">
                    <a href="javascript:;"><img border="0" class="arrowunavailable" alt="" src="<?php echo FRONT_SITE_URL ?>www/images/images1/leftarrow.png"></a>

                    <span class="paginationon">1</span>
                    <a page-index="2" href="javascript:;">2</a>
                    <a page-index="3" href="javascript:;">3</a>
                    <a page-index="4" href="javascript:;">4</a>
                    <a page-index="5" href="javascript:;">5</a>

                    <a page-index="2" href="javascript:;"><img border="0" alt="" src="<?php echo FRONT_SITE_URL ?>www/images/images1/rightarrow.png"></a>
                </div> -->
                <div class="color-main" id="paginationalone">
                        <?php $this->widget('CLinkPager', array('header' => '', 'pages' => $pages, "cssFile" => FALSE)); ?>
                    </div>


                <div class="toprowfloatright">
                    <div class="listpagelinksarea">
                        <p class="viewbylist lightgraytext">
                            View by:</p>
                        <div class="listpagelinksarea3 listpagelinksarea3off">
                            <p>
                                <a id="DisplayGalleryLink" href="javascript:;">Gallery</a></p>
                        </div>
                        <div class="listpagelinksarea1  listpagelinksarea1on">
                            <p>
                                <a id="DisplayListLink" href="javascript:;">List</a></p>
                        </div>
                    </div>
                </div>
                <p class="clearfix">
                    &nbsp;</p>
            </div>

            <div class="yescontentmiddlerow">
                <?php foreach ($models as $model): 
                   // dump($model->profile);die();
                    ?>

                    <div class="profilerepeat ">
                        <div class="profilerepeatcol1large">
                            <div id="profileoverlayplace">
                            </div>
                            <a title="" href="<?php echo FRONT_SITE_URL;?>user/profile/viewprofile?profile=<?php echo $model->user_id; ?>">
                                 <?php if ($model->userPhoto->link_img != null) { ?>
                                <img border="0" class="userpiclarge" src="<?php echo FRONT_SITE_URL ?>www/uploads/photos/thumbs/<?php echo 'thumb_' . $model->userPhoto->link_img; ?>">
                            <?php } ?>
                            <?php if ($model->userPhoto->link_img == null) { ?>
                                <img border="0" class="userpiclarge" src="<?php echo FRONT_SITE_URL ?>www/images/images1/noPhoto-1t.gif">
                            <?php } ?>
                            </a>
                        </div>
                        <div class="profilerepeatcol2large">
                            <div class="profilerepeatcol2row1">
                                <p>
                                    <a href="<?php echo FRONT_SITE_URL;?>user/profile/viewprofile?profile=<?php echo $model->user_id; ?>"><?php echo $model->username; ?></a></p>
                                <a style="" fav-member-id="5E5F724A5D1BB774" href="javascript:;">
                                    <img border="0" title="Save as Favorite" alt="" src="<?php echo FRONT_SITE_URL ?>www/images/images1/favoriteicon.png">
                                    <!--TODO: If in test and not favorite, show add to favoritest text-->
                                    Save to Favorites
                                </a><a style="display:none;" unfav-member-id="5E5F724A5D1BB774" href="javascript:;">
                                    <img border="0" title="Saved as Favorite" alt="" src="<?php echo FRONT_SITE_URL ?>www/images/images1/favoritedicon.png">
                                </a>
                            </div>
                            <div class="profilerepeatcol2row2">
                                <p>
                                      <?php
                                        $birthDate = $model->profile->birthdate;
                                        $dob = date("Y-m-d", strtotime($birthDate));

                                        $dobObject = new DateTime($dob);
                                        $nowObject = new DateTime();

                                        $diff = $dobObject->diff($nowObject);

                                        echo $diff->y;
                                    ?>
                                    | Young America, <?php echo $model->profile->country; ?> </p>
                            </div>
                            <div class="profilerepeatcol2row3">
                                <p>
                                    <a href="<?php echo FRONT_SITE_URL;?>user/profile/viewprofile?profile=<?php echo $model->user_id; ?>">View Full Profile</a></p>
                            </div>
                        </div>
                        <p class="clearfix">
                            &nbsp;</p>
                    </div>
                <?php endforeach; ?>
            </div>

            <div class="bottomrow">
                <div class="color-main" id="paginationsearch">
                    <!--<div id="paginationsearchleft">
                        <a title="Previous" class="button_style buttonunavailable" href="javascript:;">Previous</a>
                    </div>-->
                    <!--<div id="paginationsearchcenter">
                        <a href="javascript:;">
                            <img border="0" class="arrowunavailable" alt="" src="<?php echo FRONT_SITE_URL ?>www/images/images1/leftarrow.png"></a>
                        <span class="paginationon">1</span>
                        <a page-index="2" href="javascript:;">2</a>
                        <a page-index="3" href="javascript:;">3</a>
                        <a page-index="4" href="javascript:;">4</a>
                        <a page-index="5" href="javascript:;">5</a>
                        <a page-index="2" href="javascript:;">
                            <img border="0" alt="" src="<?php echo FRONT_SITE_URL ?>www/images/images1/rightarrow.png"></a>
                    </div>-->
                    <div class="color-main" id="paginationalone">
                            <?php $this->widget('CLinkPager', array('header' => '', 'pages' => $pages, "cssFile" => false)); ?>
                        </div>
                    <!--<div id="paginationsearchright">
                        <a title="Next" class="button_style" page-index="2" href="javascript:;">
                            Next</a>
                    </div>-->
                </div>
            </div>
        </div>
    </div>

<?php } ?>
